Spline interpolation method

ABSTRACT

A spline interpolation method of subjecting given points to interpolation by using a cubic spline curve is provided. A first-derivative vector is derived from a preset number of points including a starting point (P 1 ), and a cubic equation between the starting point and a next point is derived based on the coordinate values of the preset points including the starting point (P 1 ) and the extreme point condition of the starting point (P 1 ), to derive a spline curve between the starting point (P 1 ) and a point (P 2 ) next to the starting point (P 1 ). Next, the first-derivative vector at P 2  and a new next point are used instead of the starting point (P 1 ), to derive a cubic curve between P 2  and P 3 . In this way, a cubic equation between points is sequentially derived to obtain a cubic spline curve, and as a result, a spline curve posing no practical problems can be obtained without previously receiving all of the sequential points, while sequentially receiving the sequential points in a forward direction.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to a spline interpolation method, and moreparticularly, to a spline interpolation method of effecting anapproximate interpolation of a spline curve based on preset points amonga sequence of given points.

2. Description of the Related Art

An interpolation us a cubic spline curve is widely used as a method ofsubjecting a sequence of points to interpolation by using a smoothcurve.

The prior art spline interpolation is effected by the following method:

(ia) all of the specified points of the sequence are received;

(iia) simultaneous equations containing all of the sequence point dataare created and solved, to derive the first-derivative vector at eachpoint. This is effected by deriving the inverse matrix of a matrixequation described later;

(iiia) under a condition that the first-derivative vector at the secondpoint and the first-derivative vector at the starting point derived asdescribed above are used, and that the positions of a given startingpoint and a second point are set, the following cubic equationconnecting the starting point and the second point is derived, and thecalculation is effected to derive the respective positions, thuseffecting the interpolation while the parameter t of the equation ischanged from 0 to 1,

    P(t)=K.sub.4 t.sup.3 +K.sub.3 t.sup.2 +K.sub.2 t+K.sub.1

(where P(t) denotes a vector representing the position, and K₄, K₃, K₂and K₁ denote coefficient vectors); and

(iva) a cubic equation connecting the second and third points is derivedin the same manner as described above.

Another method is effected as follows:

(ib) all of the specified points of the sequence are received;

(iib) simultaneous equations containing all of the sequence point dataare created and solved, to derive the first-derivative vector at thestarting point and the first-derivative vector at a second point, andderive the second-derivative vector at the starting point based on theabove first-derivative vectors and the positions of the first and secondpoints;

(iiib) a cubic equation, which is the same as described above andconnects the starting point and the second point, is derived with thefirst-derivative vector and the second-derivative vector at the startingpoint derived as described above and used as the extreme pointcondition, and the calculation is effected to derive respectivepositions, thus effecting the interpolation while the parameter t of theequation is changed from 0 to 1; and

(ivb) a cubic equation connecting the second and third points is derivedwith the first- and second-derivative vectors of the second point in thecubic equation as described above, and the calculation then effected inthe same manner as described above to derive the respective positions,thus effecting the interpolation while the parameter t of the equationis changed from 0 to 1.

In the above-described methods, the calculations are repeatedly effectedfor the third and fourth points, the fourth and fifth points, and so on,to effect the interpolation of the cubic equation for all of thespecified sequential points so that the spline interpolation for all thesequential points can be effected.

In the above methods, however, all the specified sequential points mustbe received and the calculation therefor effected, and accordingly, thefollowing problems arise:

(a) it is impossible to limitlessly increase the number of specifiedpoints;

(b) a very large amount of matrix calculations must be effected when thenumber of specified points is large, and thus a large memory capacityand a long calculation time are required;

(c) if the matrix calculation is not effected with a high precision, thespline curve may become excessively separated from the succeedingspecified points (deviated or oscillated); and

(d) when the matrix calculation is effected on the programmer side, itis practically impossible to manually effect the calculation if thenumber of the specified points becomes equal to or larger than four, andthus an additional computing device becomes necessary.

SUMMARY OF THE INVENTION

The present invention has been made in view of the above problems, andan object thereof is to provide a spline interpolation method ofeffecting an approximate interpolation of a spline curve based on presetpoints among a sequence of given points.

In this invention, to solve the problem described above, a splineinterpolation method is provided in which given points are subjected toan interpolation using a cubic spline curve, and is characterized byderiving a first-derivative vector based on a preset number of pointsincluding a starting point, deriving a cubic equation between thestarting point and a next point based on the coordinate values of thepreset points including the starting point, the extreme point conditionof the starting point, and the first-derivative vector, to derive aspline curve between the starting point and a point next to the startingpoint, and using a new point instead of the starting point andsequentially deriving a cubic equation between the points, to therebyderive a cubic spline curve.

First, a preset number of points starting from the starting point areused to derive a cubic spline curve, then a cubic spline curve isderived by using a new point instead of an initial point, andaccordingly, a spline curve between points is sequentially derived toeffect the spline interpolation process.

Therefore, the spline interpolation process can be effected withoutpractical problems by sequentially receiving points in a forwarddirection without previously receiving all of the sequential points.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a diagram showing a spline curve;

FIG. 2 is a flowchart showing the process for deriving a spline curve inthe present invention;

FIG. 3 is a block diagram of a numerical control device for effectingthe present invention;

FIG. 4 is a diagram showing the construction of a matrix [A];

FIG. 5 is a diagram showing the construction of a matrix [B];

FIG. 6 is a diagram showing the construction of another matrix [A];

FIG. 7 is a diagram showing the construction of another matrix [B];

FIG. 8 is a diagram showing the general construction of a matrix [A]⁻¹ ;

FIG. 9 is a diagram showing the concrete construction of a matrix [A]⁻¹; and

FIG. 10 is a diagram showing the concrete construction of another matrix[A]⁻¹.

DESCRIPTION OF THE PREFERRED EMBODIMENT

An embodiment of the present invention will now be described withreference to the accompanying drawings.

First, a feature of this invention is described. Attention is paid tothe fact that, in the step of "deriving the first-derivative vector ateach point based on all of the sequential points" in the conventionalmethod (iia) of deriving a spline curve, a point among all of thesequential points nearer to a corresponding point at which thefirst-derivative vector is to be derived has a larger influence on thefirst-derivative vector, and the first-derivative vector at thecorresponding point is approximately derived based on a sequence ofpoints among all of the sequential points and nearer to thecorresponding point, to create a cubic equation and effect the splineinterpolation.

Further, a practical spline curve interpolation can be attainedaccording to the following process, for example, set as the conditiongiven in the starting point.

(a) Only a desired sequence of points is given and the second-derivativevector at the starting point is set to 0.

(b) The first-derivative vectors at the starting point and the desiredsequential points are given.

Next, the principle of the present invention is described.

FIG. 1 shows a sequence of points subjected to a spline interpolationand a spline curve. Points P₁ to P_(L) indicate a sequence of points inwhich point P₁ is a starting point, point P_(L) is an end point, andpoints P_(L+1) to P_(L+m-1) are auxiliary points used for effecting aninterpolation near the end point P_(L). P₁.sup.(1) to P₄.sup.(1)indicate first-derivative vectors and SC is a spline curve.

(1) First-derivative vector

The first-derivative vector at each point of a cubic spline curvepassing all of the sequential points P₁ to P_(n) (n points) is generallyderived as follows.

A cubic equation constituting the spline curve is generally shown by thefollowing equation:

    P(t)=K.sub.4 t.sup.3 +K.sub.3 t.sup.2 +K.sub.2 t+K.sub.1   (1)

where P(t) is a position vector which varies according to the parametert, and K₄, K₃, K₂ and K₁ are coefficient vectors. That is, when an XYZcoordinate is used, P(t)=(x(t), y(t), z(t)) and K_(i) =(K_(ix), K_(iy),K_(iz)) (where i=1, 2, 3 or 4). The parameter t is determined such that0≦t≦1.

Accordingly, the first-derivative vector P.sup.(1) is expressed asfollows:

    P.sup.(1) (t)=3K.sub.4 t.sup.2 +2K.sub.3 t+K.sub.2         (2)

At this time, the first-derivative vector [P.sup.(1) ] at each point canbe expressed by the following equation:

    [A][P.sup.(1) ]=[B]                                        (3)

Further, the matrix [P.sup.(1) ] of the first-derivative vector is amatrix of n rows×1 column expressed by ##EQU1## and P₁.sup.(1) toP_(n).sup.(1) are first-derivative vectors at P₁ to P_(n).

At this time, it is generally known that the matrices [A] and [B] can beexpressed as follows, according to the extreme point condition.

(i) In the case of the first extreme point condition:

(a) The second-derivative vector at the starting point (P₁) is 0.

(b) The second-derivative vector at the end point (P_(n)) is 0.

At this time, the matrix [A] is expressed by n rows×n columns, as shownin FIG. 4, and the matrix [B] is expressed by n rows×1 column, as shownin FIG. 5.

(ii) In the case of the second extreme point condition:

(a) The first-derivative vector P₁.sup.(1) at the starting point (P₁) isgiven.

(b) The second-derivative vector at the end point (P_(n)) is 0.

At this time, the matrix [A] is expressed by n rows×n columns, as shownin FIG. 6, and the matrix [B] is expressed by n rows×1 column, as shownin FIG. 7.

From the equation (3), [P.sup.(1) ] can be derived by [P.sup.(1) ]=[A]⁻¹[B]. The matrix [A]⁻¹ is expressed by n rows×n columns, as shown in FIG.8.

At this time, the absolute values of elements of the matrix [A]⁻¹ shownin FIG. 8 are large in the diagonal elements (a_(k),k k=1 to n) andbecome smaller in the elements which are farther away. Further, thematrix is a fixed matrix set by the extreme point condition.

Concretely, the matrix shown by an equation (5) of FIG. 9 is obtainedwhen n is set at 50 in the extreme point condition 1. Further, thematrix shown by an equation (6) of FIG. 10 is obtained when n is set at50 in the extreme point condition 2.

Approximation of the first-derivative vector

From the above-described theory, the first-derivative vector P₁.sup.(1)can be approximated as follows: ##EQU2## (the precision of theapproximation is enhanced as k is made larger).

In this case, b_(i) is an i-th element of the matrix [B]. Based on this,P_(i).sup.(1) can be derived without using all of the elements of [B],i.e., without using all of the sequential points.

FORMATION OF A CUBIC EQUATION AND INTERPOLATION

If the first-derivative vector P_(i).sup.(1) at P_(i) can be obtained,the following conditional equations can be derived by applying thepoints P_(i) and P_(i).sup.(1) to the equations (1) and (2):

    P.sub.i =P.sub.i (0)=K.sub.i1                              (8)

    P.sub.i.sup.(1) =P.sub.i.sup.(1) (0)=K.sub.i2              (9)

    P.sub.i+1 =P.sub.i (1)=K.sub.i4 +K.sub.i3 +K.sub.i2 +K.sub.i1 (10)

    P.sub.i+1.sup.(1) =P.sub.i.sup.(1) (1)=3K.sub.i4 +2K.sub.i3 +K.sub.i2 (11)

(where P_(i) (0) and P_(i) (1) are values of P_(i) (t) when t=0 and t=1where P(t) in the equation (1) is applied to P_(i) to P_(i+1), andK_(i4), K_(i3), K_(i2) and K_(i1) are respective coefficients of t³, t²,t¹ and t⁰ in P_(i) (t). Further, P_(i).sup.(1) (0) and P_(i).sup.(1) (1)are values of the first-derivative vector when t=0 and t=1).

From the above four equations, four coefficients K_(i4), K_(i3), K_(i2)and K_(i1) can be obtained.

In this way, P_(i) (t) is sequentially derived and connected to create aspline curve.

When a cubic equation is derived by the above method, errors ofP_(i).sup.(1) and P_(i).sup.(2) with respect to the theoretical valuesthereof are not accumulated, and thus the errors can be suppressed to anegligible small value by adequately setting k in the equation (7).Therefore, a spline curve which poses no practical problems can bederived from the spline curve obtained by the present method, withoutenlarging the errors with respect to a spline curve obtainedtheoretically from a sequence of given points.

CONCRETE EXAMPLE

Next, a case wherein a spline curve is created by effecting theinterpolation up to a point P_(i) and deriving the first-derivativevector P_(i+1).sup.(1) at a next point is explained as a concreteexample of the present method.

CREATION OF A FIRST CUBIC EQUATION

First, a first cubic equation is created and subjected to interpolation.

(i) P₁ to P_(1+m) ((m+1) points; m is a constant and (m+1) is a numberof buffers for receiving them) are received.

(ii) Assuming that P₁ is followed by a countless number of points,P₂.sup.(1) is derived from the equation (7).

(a) When the second-derivative vector P₁.sup.(2) is 0 at the startingpoint, P₂.sup.(1) is derived as follows by using the second row in thematrix of the equation (5), since the matrix obtained when assuming thatP₁ is followed by a countless number of points is substantially equal tothe matrix of the equation (5). ##EQU3##

(b) Where the first-derivative vector P₁.sup.(1) is given at thestarting point, P₂.sup.(1) is derived as follows by using the second rowin the matrix of the equation (6) since the matrix obtained whenassuming that P₁ is followed by a countless number of points issubstantially equal to the matrix of the equation (6). ##EQU4##

The following condition (a) or (b) is used according to the extremepoint condition:

(a) Where the second-derivative vector P₁.sup.(2) is 0 at the startingpoint,

    P.sub.1.sup.(2) =0 or 2K.sub.3 =0                          (13)-1

(b) Where the first-derivative vector P₁.sup.(1) is given at thestarting point,

    P.sub.1.sup.(1) =P.sup.(1) (0)=K.sub.2                     (13)-2

    P.sub.2 =P(1)=K.sub.4 +K.sub.3 +K.sub.2 +K.sub.1           (14)

    P.sub.2.sup.(1) =P.sup.(1) (1)=3K.sub.4 +2K.sub.3 +K.sub.2 (15)

Coefficients K₄, K₃, K₂ and K₁ are derived from the four conditionalequations (12), (13), (14) and (15), to create a cubic equation, and thecubic equation is subjected to interpolation.

CREATION OF SECOND AND LATER CUBIC EQUATION

Next, a second or later cubic equation (i-th; i>=2) is created and issubjected to interpolation.

(i) P_(i+m) is received (a state is set up in which (m+1) points P_(i)to P_(i+m) are received).

(ii) Assuming that a spline curve on which P_(i) is followed by acountless number of points is given, an approximate tangential vectorP_(i+1).sup.(1) at the second point on the curve is derived by using theequation (7). P_(i+1).sup.(1) is derived as follows, using the secondrow in the matrix of the equation (6), since the matrix obtained whenassuming that P₁ is followed by a countless number of points issubstantially equal to the matrix of the equation (6). ##EQU5##

(iii) P_(i) =P_(i) (0)=K₁

    P.sub.i.sup.(1) =P.sub.i.sup.(1) (0)=K.sub.2

(Pi.sup.(1) has been derived by the spline curve up to P_(i))

    P.sub.i+1 =P.sub.1 (1)=K.sub.4 +K.sub.3 +K.sub.2+K.sub.1

    P.sub.i+1.sup.(1) =P.sub.i+1.sup.(1) (1)=3K.sub.4 +2K.sub.3 +K.sub.2

Coefficients K₄, K₃, K₂ and K₁ are derived from the above conditionalequations to create a cubic equation, and the cubic equation issubjected to interpolation.

(3) When the end point P_(L) is reached, the process (2) is repeatedlyeffected to sequentially create cubic equations between points P_(L-m)to P_(L) while auxiliary P_(L), P_(L+1), . . . , P_(L+m-1) are created.

In this case, ##EQU6##

FLOWCHART

The processing flowchart of the present invention is shown in FIG. 2. InFIG. 2, each numeral following S denotes a step number.

[S1] Set i to 1.

[S2] Receive points P_(i) to P_(i+m). Make (m+1) points by creatingauxiliary points when a point to be received has exceeded the end point.

[S3] Execute S4 when i=1, i.e., the starting point is specified; andexecute S5 when a point other than the starting point is specified.

[S4] Create a cubic equation under a condition including the startingpoint.

[S5] Create a cubic equation under a condition excluding the startingpoint.

[S6] Derive coefficients of the created cubic equation and effect theinterpolation between points by using the cubic equation.

[S7] Increment i by 1 and effect the interpolation for a next cubicequation between points.

[S8] Determine whether or not P_(i) is an end point, and if it is notthe end point, the process returns to S2 and the interpolation iscontinuously effected.

CONSTRUCTION OF HARDWARE

FIG. 3 shows the construction of the hardware of a numerical controldevice (CNC) for effecting the present invention. In FIG. 3, 11 denotesa processor for global control (CPU), 12 denotes a ROM in which acontrol program and the like used for deriving a spline curve arestored, 13 denotes a RAM for storing interim data and the like of apoint on the spline curve, and 14 denotes a nonvolatile memory in whichthe derived spline curve, machining program, parameters and the like arestored. Numeral 14a denotes a machining program.

Numeral 15 denotes a PMC (programmable machine controller) whichreceives instructions such as M-function and T-function, converts theminto signals for controlling the machine tool, and outputs the same. TheM-function and the like are processed according to a sequence program15a and then supplied from an input/output circuit to a control circuiton the machine side. Numeral 16 denotes a display control circuit whichconverts a digital signal into a display signal; 16a denotes a displayunit, which can be a CRT, liquid crystal display device or the like; and17 denotes a keyboard used for inputting various data.

Numeral 18 denotes a position control circuit for controlling aservomotor; 19 denotes a servo amplifier for controlling the speed ofthe servomotor; 20 denotes the servomotor; 21 denotes a tachometergenerator for effecting the speed feedback; and 22 denotes a positiondetector, which can be a pulse coder, optical scale or the like. Theabove elements must be provided in a number corresponding to the numberof axes, but in this case, the elements for only one axis are shown.

Numeral 23 denotes an input/output circuit for transferring digitalsignals with respect to the external unit, and a tool select signal(T-signal) for controlling the replacement of tools is output from thecircuit to the machine-side control circuit. Numeral 24 denotes a manualpulse generator for moving each axis in a digital manner.

In the above construction, a single processor is used, but it is alsopossible to use a processor for global control and a processor forderiving a spline curve, thus constructing a multi-processor. Further,it is possible to add a co-processor or the like to enhance theoperation speed.

Further, an automatic programming device other than the numericalcontrol device can be applied to carry out the spline interpolationmethod of this invention.

As described above, according to the present invention, since a cubicspline curve between points is sequentially derived based on a presetnumber of points among a sequence of given points, a practical splinecurve can be derived in a short period of time even when the number ofpoints to be interpolated becomes larger.

Further, the extreme point condition is set with the second-derivativevector set at 0, so that the interpolation of the spline curve can beeffected without setting the condition of the first-derivative vector atthe extreme point or the starting point.

In addition, a smooth spline curve can be obtained near the end point byproviding auxiliary points after the end point.

We claim:
 1. A spline interpolation method for performing machiningaccording to sequentially created cubic spline curves by subjectinggiven points to interpolation using the cubic spline curves, comprisingthe steps of:deriving a first-derivative vector from a preset number ofpoints including a starting point; deriving a first cubic equationbetween said starting point and a next point based on coordinate valuesof the preset number of points including said starting point, an extremepoint condition of said starting point and said first-derivative vector,to derive a first cubic spline curve between said starting point and apoint next to said starting point; using a new point instead of saidstarting point and sequentially deriving a second cubic equation betweenpoints, to thereby derive a second cubic spline curve; and performingmachining in accordance with the first and second cubic spline curves.2. A spline interpolation method according to claim 1, wherein the cubicspline curve is subjected to interpolation in said extreme pointcondition in which second-derivative vectors at said starting point andan end point are set at
 0. 3. A spline interpolation method according toclaim 1, wherein the cubic spline curve is subjected to interpolation insaid extreme point condition in which the first-derivative vector at thestarting point is given and a second-derivative vector at an end pointis set at
 0. 4. A spline interpolation method according to claim 1,characterized in that the cubic spline curve near an end point isderived by using auxiliary points after the end point.
 5. A splineinterpolation method for performing machining according to sequentiallycreated cubic spline curves by subjecting given points to interpolationusing the cubic spline curves, comprising the steps of:deriving afirst-derivative vector from a preset number of points including astarting point; deriving a first cubic equation between said startingpoint and a next point including said starting point, an extreme pointcondition of said starting point and said first-derivative vector, toderive a first spline curve between said starting point and a point nextto said starting point; using a new point instead of said starting pointand sequentially deriving a second cubic equation between points, tothereby derive a second cubic spline curve; distributing interpolationpulses in accordance with the cubic spline curves; driving servo motorswith the interpolation pulses; and performing machining along the cubicspline curve.
 6. A spline interpolation method according to claim 5,wherein the cubic spline curve is subjected to interpolation ins aidextreme point condition in which second-derivative vectors at saidstarting point and an end point are set at
 0. 7. A spline interpolationmethod according to claim 5, wherein the cubic spline curve is subjectedto interpolation in said extreme point condition in which thefirst-derivative vector at the starting point is given and asecond-derivative vector at an end point is set at
 0. 8. A splineinterpolation method according to claim 5, characterized in that thecubic spline curve near an end point is derived by using auxiliarypoints after the end point.